//************************************************************
//    > File Name: strlen.c
//    > Author: davis
//    > Mail:  
//    > Created Time: 2017年03月16日 11:28:43
//***********************************************************

#include<stdio.h>
#include<string.h>
void func(char k[]){
	printf("strlen(k) is %d,sizeof(k) is %d\n",strlen(k),sizeof(k));
}
int main()
{
	char a[10]="abc";
	printf("strlen(a) is %d,sizeof(a) is %d\n",strlen(a),sizeof(a));
	
	char b[10]={'a','b','c'};
	printf("strlen(b) is %d,sizeof(b) is %d\n",strlen(b),sizeof(b)); //value of strlen(b) is not fixed

	char c[]="ab";
	printf("strlen(c) is %d,sizeof(c) is %d\n",strlen(c),sizeof(c));

	char d[]={'a','b','c'};
	printf("strlen(d) is %d,sizeof(d) is %d\n",strlen(d),sizeof(d)); // the value of strlen(d) is not fixed 
	
	char d2[]={'a','b','c','\0'};
	printf("strlen(d2) is %d,sizeof(d2) is %d\n",strlen(d2),sizeof(d2));

	char d3[]={'a','b','c','\0','d','e'};
	printf("strlen(d3) is %d,sizeof(d3) is %d\n",strlen(d3),sizeof(d3));
	
	
	char *e="abcdef";
	printf("strlen(e) is %d,sizeof(e) is %d\n",strlen(e),sizeof(e));
	char e2[]="abcdef";
	printf("strlen(e2) is %d,sizeof(e2) is %d\n",strlen(e2),sizeof(e2));
	char e3[]={'a','b','c','d','e','f'};//end + '\0'
	printf("strlen(e3) is %d,sizeof(e3) is %d\n",strlen(e3),sizeof(e3)); //strlen(e3) not fixed

	func(e);
	func(e2);
	func(e3);

	return 0;
}



/***************************
strlen(a) is 3,sizeof(a) is 10
strlen(b) is 3,sizeof(b) is 10
strlen(c) is 2,sizeof(c) is 3
strlen(d) is 6,sizeof(d) is 3
strlen(d2) is 3,sizeof(d2) is 4
strlen(d3) is 3,sizeof(d3) is 6
strlen(e) is 6,sizeof(e) is 4
strlen(e2) is 6,sizeof(e2) is 7
strlen(e3) is 12,sizeof(e3) is 6
strlen(k) is 6,sizeof(k) is 4
strlen(k) is 6,sizeof(k) is 4
strlen(k) is 12,sizeof(k) is 4

****************************/

